﻿Public Class TopGlowOperation
    Inherits ImageOperationBase
    Private _color As Color
    Private _heightratio As Integer
    Public Sub New(ByVal Color As Color, Optional ByVal HeightRatio As Integer = 4)
        _color = Color
        If HeightRatio = 0 Then
            HeightRatio = 4
        End If
        _heightratio = HeightRatio
    End Sub
    Public Overrides Sub ExecuteExtension(ByRef g As System.Drawing.Graphics, ByRef b As System.Drawing.Bitmap)
        Dim gradbrush As New LinearGradientBrush(New Rectangle(0, 0, b.Width, CInt(b.Height / _heightratio)), ControlPaint.Light(_color, 1.0F), _color, LinearGradientMode.Vertical)
        g.FillRectangle(gradbrush, New Rectangle(0, 0, b.Width, CInt(b.Height / _heightratio)))
        g.FillRectangle(New SolidBrush(_color), 0, CInt(b.Height / _heightratio), b.Width, b.Height - (CInt(b.Height / _heightratio)))
    End Sub
End Class